﻿using System;
using System.Html.DOM;

namespace jQueryLib
{
    public partial class JQueryInstance
    {
        /// <summary>
        /// Iterate over a jQuery object, executing a function for each matched element.
        /// </summary>
        /// <param name="func">We can stop the loop from within the callback function by returning false.</param>
        /// <returns></returns>
        public abstract JQueryInstance Each(Func<bool, int, object> func);

        /// <summary>
        /// Retrieve the DOM elements matched by the jQuery object.
        /// </summary>
        /// <returns></returns>
        public abstract HtmlElement[] Get();

        /// <summary>
        /// Retrieve the DOM elements matched by the jQuery object.
        /// </summary>
        /// <param name="idx"></param>
        /// <returns></returns>
        public abstract HtmlElement Get(int idx);

        /// <summary>
        /// Search for a given element from among the matched elements.
        /// </summary>
        /// <returns></returns>
        public abstract int Index();

        /// <summary>
        /// Search for a given element from among the matched elements.
        /// </summary>
        /// <param name="selector"></param>
        /// <returns></returns>
        public abstract int Index(string selector);

        /// <summary>
        /// Search for a given element from among the matched elements.
        /// </summary>
        /// <param name="elem"></param>
        /// <returns></returns>
        public abstract int Index(HtmlElement elem);

        /// <summary>
        /// Search for a given element from among the matched elements.
        /// </summary>
        /// <param name="jquery"></param>
        /// <returns></returns>
        public abstract int Index(JQueryInstance jquery);

        /// <summary>
        /// Retrieve all the DOM elements contained in the jQuery set, as an array.
        /// </summary>
        /// <returns></returns>
        public abstract HtmlElement[] ToArray();
    }
}
